﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Globalization;
using GeoVision.Addin.Core.Settings;

namespace GeoVision.Addin.Helpers
{
    public static class LocalizationHelper
    {
        public static void SetCulture(CultureSettins culture)
        {
            RegistryHelper.SaveCurrentLanguage(culture);
            CultureInfo info = RegistryHelper.ReadCurrentLanguage();
            Thread.CurrentThread.CurrentCulture = info;
            Thread.CurrentThread.CurrentUICulture = info;
        }
        public static void SetCulture()
        {
            CultureInfo info = RegistryHelper.ReadCurrentLanguage();
            if (info == null)
            {
                CultureInfo cinfo = new CultureInfo(CultureShortName.ENG);

                Thread.CurrentThread.CurrentCulture = info;
                Thread.CurrentThread.CurrentUICulture = info;
            }
            else
            {
                Thread.CurrentThread.CurrentCulture = info;
                Thread.CurrentThread.CurrentUICulture = info;
            }
        }
    }
}
